/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Jirka
 */
@Entity
@Table(name = "name")
@NamedQueries({@NamedQuery(name = "Name.findAll", query = "SELECT n FROM Name n"), @NamedQuery(name = "Name.findByName", query = "SELECT n FROM Name n WHERE n.name = :name"), @NamedQuery(name = "Name.findByOrigin", query = "SELECT n FROM Name n WHERE n.origin = :origin"), @NamedQuery(name = "Name.findByNameId", query = "SELECT n FROM Name n WHERE n.nameId = :nameId")})
public class Name implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @Column(name = "name")
    private String name;
    @Basic(optional = false)
    @Column(name = "origin")
    private String origin;
    @Id
    @Basic(optional = false)
    @Column(name = "name_id")
    private Integer nameId;

    public Name() {
    }

    public Name(Integer nameId) {
        this.nameId = nameId;
    }

    public Name(Integer nameId, String name, String origin) {
        this.nameId = nameId;
        this.name = name;
        this.origin = origin;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getOrigin() {
        return origin;
    }

    public void setOrigin(String origin) {
        this.origin = origin;
    }

    public Integer getNameId() {
        return nameId;
    }

    public void setNameId(Integer nameId) {
        this.nameId = nameId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nameId != null ? nameId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Name)) {
            return false;
        }
        Name other = (Name) object;
        if ((this.nameId == null && other.nameId != null) || (this.nameId != null && !this.nameId.equals(other.nameId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Name[nameId=" + nameId + "]";
    }

}
